//
//  LZSTypeViewController.m
//  IOSProject
//
//  Created by lzs on 2018/4/20.
//  Copyright © 2018年 com.linzhisheng. All rights reserved.
//

#import "LZSTypeViewController.h"
#import <ZJScrollPageView.h>
//#import "LZSOneVC.h"
//#import "LZSTwoVC.h"
//#import "LZSThreeVC.h"
//
//#import "LZSTypeViewController.h"
#import "LZSResultViewController.h"
#import "LZSHisRestViewController.h"
#import "LZSJisuanViewController.h"

@interface LZSTypeViewController ()<ZJScrollPageViewDelegate>
@property (nonatomic, weak) ZJScrollPageView *scrollPageView;
@end

@implementation LZSTypeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor whiteColor];
    
    
    //    LZSTypeViewController *words = [[LZSTypeViewController alloc] init];
    LZSResultViewController *voice = [[LZSResultViewController alloc] init];
    //    voice.lottery_id = self.lottery_id;
    voice.lottery_id = self.caipiaoid;
    LZSHisRestViewController *picture = [[LZSHisRestViewController alloc] init];
    //    picture.lottery_id = self.lottery_id;
    picture.lottery_id = self.caipiaoid;
    LZSJisuanViewController *pictures = [[LZSJisuanViewController alloc] init];
    //    pictures.lottery_id = self.lottery_id;
    pictures.lottery_id = self.caipiaoid;
    
    //    [self addChildViewController:words];
    [self addChildViewController:voice];
    [self addChildViewController:picture];
    [self addChildViewController:pictures];
    
    self.scrollPageView.backgroundColor = [UIColor groupTableViewBackgroundColor];
    
    //    [self presentViewController:[[LZSWebViewViewController alloc] init] animated:YES completion:nil];
}

#pragma mark - getter

- (ZJScrollPageView *)scrollPageView
{
    if(_scrollPageView == nil)
    {
        ZJSegmentStyle *style = [[ZJSegmentStyle alloc] init];
        //显示滚动条
        style.showLine = YES;
        // 颜色渐变
        style.gradualChangeTitleColor = YES;
        
        style.animatedContentViewWhenTitleClicked = NO;
        
        style.autoAdjustTitlesWidth = YES;
        
        CGFloat h = NaviHeight;
        
        ZJScrollPageView *scrollPageView = [[ZJScrollPageView alloc] initWithFrame:CGRectMake(0, h, self.view.frame.size.width, self.view.frame.size.height - h) segmentStyle:style titles:@[@"开奖结果",@"历史开奖",@"开奖计算器"] parentViewController:self delegate:self];
        
        UIView *lineview = [[UIView alloc] init];
        lineview.frame = CGRectMake(0, 44, self.view.frame.size.width, 1);
        [scrollPageView addSubview:lineview];
        lineview.backgroundColor = [UIColor lightGrayColor];
        [self.view addSubview:scrollPageView];
        _scrollPageView = scrollPageView;
        
        scrollPageView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
        
        
    }
    return _scrollPageView;
}


#pragma mark - ZJScrollPageViewDelegate
- (NSInteger)numberOfChildViewControllers {
    
    return self.childViewControllers.count;
    
}

- (UIViewController <ZJScrollPageViewChildVcDelegate> *)childViewController:(UIViewController<ZJScrollPageViewChildVcDelegate> *)reuseViewController forIndex:(NSInteger)index {
    
    
    UIViewController<ZJScrollPageViewChildVcDelegate> *childVc = reuseViewController;
    
    if (!childVc) {
        
        childVc = self.childViewControllers[index];
        
    }
    
    return childVc;
}

- (BOOL)shouldAutomaticallyForwardAppearanceMethods {
    return NO;
}


/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
